import Vue from 'vue'

import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		shopDetail: {}, // 当前商家详细信息
		subCurrent: 1, // 当前选中的状态0-堂食 1-外卖
		seatNums: 1, // 桌号 
		selfAddress: {}, // 用户经纬度
		orderInfoId: "92d37168-04b3-4137-ac47-9183093e926a", // 查看订单详情Id
		selCurrent: 1, // 订单详情状态0-堂食 1-外卖
		shopId: 1, // 扫码店铺id
	},
	mutations: {
		setShopDetail(state, data) { // 注意这里需要传入data参数
			state.shopDetail = data;
		},
		setSubCurrent(state, status) { // 添加status参数用于接收新的状态值
			state.subCurrent = status;
		},
		setSeatNums(state, data) {
			state.seatNums = data;
		},
		setSelfAddress(state, data) {
			state.selfAddress = data;
		},
		setOrderInfoId(state, data) {
			state.orderInfoId = data;
		},
		setSelCurrent(state, data) {
			state.selCurrent = data;
		},
		setShopId(state, data) {
			state.shopId = data;
		}
		//相当于同步的操作
	},
	actions: {
		//相当于异步的操作,不能直接改变state的值，只能通过触发mutations的方法才能改变
	}
})
export default store